class Solution {
public:
    int waysToStep(int n) {
        if(n == 0) return 1;
        if(n == 1)  return 1;
        if(n == 2)  return 2;
        long long a = 1, b = 1, c = 2, d = 0;
        for(int i = 3; i <= n; i++)
        {
            d = a + b + c;
            d %= 1000000007;
            a = b, b = c, c = d;
        }
        return d;
    }
};